const user = {
  state: {
    phone: '',
    userId: '',
    openId: '',
    name: '未命名'
  },

  mutations: {
    SET_PHONE: (state, phoneNumber) => {
      state.phone = phoneNumber
    },
    SET_USERID: (state, userId) => {
      state.userId = userId
    },
    SET_NAME: (state, name) => {
      state.name = name
    }
  },
  actions: {
    updatePhoneNumber ({ commit }, phoneNumber) {
      commit('SET_PHONE', phoneNumber)
    },
    updateUserId ({ commit }, userId) {
      commit('SET_USERID', userId)
    },
    updateName ({ commit }, name) {
      commit('SET_NAME', name)
    }
  }
}
export default user
